package cn.kgc.shiro02.exception;

import org.apache.shiro.authz.AuthorizationException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;

/**
 * @author: mosin
 * @version: v1.0  2022/6/1
 */
@ControllerAdvice
public class GlobalException {

    @ExceptionHandler(AuthorizationException.class)
    @ResponseBody
    public Object  authorizationException(Exception e){
        HashMap<String, Object> map = new HashMap<>();
        map.put("code", "500");
        map.put("msg", "没有操作权限");
        return map ;
    }


}
